package com.sdutcm.springbootjpa.Dao;

/*
 *@Author Yan
 *@Create 2019-09-01 20:05
 */

import com.sdutcm.springbootjpa.Entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface StudentDao extends JpaRepository<Student,Integer>, JpaSpecificationExecutor<Student> {


	public List<Student> findByAgeAndName(Integer age,String name);

	public List<Student> findByAgeLessThan(Integer age);

	// jpql语法
	// @Query(nativeQuery = true, value = "select * from Student")
	// sql语法
	@Query(nativeQuery = false, value = "from Student")
	public List<Student> findsql();

	@Query("from Student where id = ?1 and  name = ?2")
	public Student findS(Integer id, String name);

	public List<Student> findByNameLikeAndAge()
}

